import requests
from ddddocr import DdddOcr
from log.ip import get_ip_requests
ip = get_ip_requests()

res = requests.get("https://www.labnetwork.com.cn/gateway/basic/mall/oauth/code?0.09091207818616409",proxies=ip)
data = res.json()["data"]
uuid = data["uuid"]
img = data["img"][22:]

ocr = DdddOcr()
r = ocr.classification(img)
print(r)

longin_res = requests.post('https://www.labnetwork.com.cn/gateway/basic/mall/oauth/login',json={
    "userEmail": "1375395139@qq.com",
    "password": "Zzzf0904",
    "captchaCode": f"{r}",
    "captchaKey": f"{uuid}"
},proxies=ip)
token = longin_res.json()['data']['userInfo']['token']
print(token)

res_detail = requests.post('https://www.labnetwork.com.cn/gateway/oldapi/mall/chemical/products',headers={
    'token': token,
},
   json={
    "query": "",
    "country": "CN",
    "pageSize": 10,
    "chemIds": [],
    "suppliers": [],
    "rank": 0,
    "packSize": "",
    "packUnit": "",
    "unitStock": "",
    "selectedUnit": "",
    "molecularWeightLow": "",
    "molecularWeightHigh": "",
    "locations": [],
    "startRecord": 0
}        ,                proxies=ip)
print(res_detail.json())